_GtkFileChooserButtonPrivate: Added has_title flag so we can remember
authorMurray Cumming <murrayc@murrayc.com>
Wed, 19 Apr 2006 17:21:55 +0000 (17:21 +0000)
committerMurray Cumming <murrayc@src.gnome.org>
Wed, 19 Apr 2006 17:21:55 +0000 (17:21 +0000)
2006-04-19  Murray Cumming  <murrayc@murrayc.com>

        * gtk/gtkfilechooserbutton.c: _GtkFileChooserButtonPrivate:
        Added has_title flag so we can remember whether a title has
        been set.
        (gtk_file_chooser_button_constructor): If no title has been
        set then set it to the default title. This means that the
        default title will be used if the dialog was instantiated with
        g_object_new(), without using the gtk_file_chooser_button_new()
        convenience function. This helps language bindings.
        (gtk_file_chooser_button_set_property): Set has_title when
        setting the title.

ChangeLog
ChangeLog.pre-2-10
gtk/gtkfilechooserbutton.c

index c1907f29a32c1d54be97d539ceb56c17b0544671..5145f16b712179534346bf9a55ff93faf1fc3d9c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2006-04-19  Murray Cumming  <murrayc@murrayc.com>
+
+       * gtk/gtkfilechooserbutton.c: _GtkFileChooserButtonPrivate:
+       Added has_title flag so we can remember whether a title has 
+       been set.
+       (gtk_file_chooser_button_constructor): If no title has been
+       set then set it to the default title. This means that the 
+       default title will be used if the dialog was instantiated with 
+       g_object_new(), without using the gtk_file_chooser_button_new() 
+       convenience function. This helps language bindings.
+       (gtk_file_chooser_button_set_property): Set has_title when 
+       setting the title.
+
 2006-04-19  Tor Lillqvist  <tml@novell.com>
 
        * gdk/win32/gdkkeys-win32.c (handle_special): Map VK_NUMPAD[0-9]
index c1907f29a32c1d54be97d539ceb56c17b0544671..5145f16b712179534346bf9a55ff93faf1fc3d9c 100644 (file)
@@ -1,3 +1,16 @@
+2006-04-19  Murray Cumming  <murrayc@murrayc.com>
+
+       * gtk/gtkfilechooserbutton.c: _GtkFileChooserButtonPrivate:
+       Added has_title flag so we can remember whether a title has 
+       been set.
+       (gtk_file_chooser_button_constructor): If no title has been
+       set then set it to the default title. This means that the 
+       default title will be used if the dialog was instantiated with 
+       g_object_new(), without using the gtk_file_chooser_button_new() 
+       convenience function. This helps language bindings.
+       (gtk_file_chooser_button_set_property): Set has_title when 
+       setting the title.
+
 2006-04-19  Tor Lillqvist  <tml@novell.com>
 
        * gdk/win32/gdkkeys-win32.c (handle_special): Map VK_NUMPAD[0-9]
index 4a5180c94242931af05b81c510e9d05aea687ef8..390ded1b14511fae7dd36e1a2eabe0001388e1e3 100644 (file)
@@ -156,6 +156,9 @@ struct _GtkFileChooserButtonPrivate
   /* Used for hiding/showing the dialog when the button is hidden */
   guint8 active                       : 1;
 
+  /* Used to remember whether a title has been set yet, so we can use the default if it has not been set. */
+  guint8 has_title                    : 1;
+
   /* Used to track whether we need to set a default current folder on ::map() */
   guint8 folder_has_been_set          : 1;
 
@@ -648,6 +651,10 @@ gtk_file_chooser_button_constructor (GType                  type,
                                               -1);
     }
 
+  /* Set the default title if necessary. We must wait until the dialog has been created to do this. */
+  if (!priv->has_title)
+    gtk_file_chooser_button_set_title (button, _(DEFAULT_TITLE));
+
   current_folder = gtk_file_chooser_get_current_folder_uri (GTK_FILE_CHOOSER (priv->dialog));
   if (current_folder != NULL)
     {
@@ -786,6 +793,9 @@ gtk_file_chooser_button_set_property (GObject      *object,
       break;
 
     case PROP_TITLE:
+      /* Remember that a title has been set, so we do no try to set it to the default in _init(). */
+      priv->has_title = TRUE;
+      /* Intentionally fall through instead of breaking here, to actually set the property. */
     case GTK_FILE_CHOOSER_PROP_FILTER:
     case GTK_FILE_CHOOSER_PROP_LOCAL_ONLY:
     case GTK_FILE_CHOOSER_PROP_PREVIEW_WIDGET: